package info.empathymobile.monitor.business.beans;

import java.util.Calendar;
import java.util.Date;

import com.j256.ormlite.field.DatabaseField;

public class MonitorEntry {
	
	public static final int BATTERY_ENTRY_LOG_CLASS = 0;
	public static final int CONNECTIVITY_ENTRY_LOG_CLASS = 1;
	public static final int OS_ENTRY_LOG_CLASS = 2;
	
	public static final int CONNECTIVITY_ENTRY_NET_CONNECTED = 1;
	public static final int CONNECTIVITY_ENTRY_NET_DISCONNECTED = 0;
	public static final int BATTERY_ENTRY_POWER_CONNECTED = 1;
	public static final int BATTERY_ENTRY_POWER_DISCONNECTED = 0;
	public static final int OS_ENTRY_SHUTDOWN = 0;
	public static final int OS_ENTRY_BOOT = 1;
	
	// id is generated by the database and set on the object automagically
	@DatabaseField(generatedId = true)
	private int id;
	@DatabaseField
	private Date date;
	
	@DatabaseField
	private int logClass = -1; //battery log or connectivity log.
	@DatabaseField
	private int status = -1; //connected or not, charging or not, and full charged
	@DatabaseField
	private int type = -1; //for battery (charger type) for connectivity (wireless device type)
	@DatabaseField
	private int timeZone;
	
	public MonitorEntry() {
		// needed by ormlite
		this.date = new Date(System.currentTimeMillis());
	    this.timeZone = Calendar.getInstance().getTimeZone().getOffset(date.getTime());
	}

	public MonitorEntry(int logClass, int status, int type) {
		this();
		this.logClass = logClass;
		this.status = status;
		this.type = type;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getLogClass() {
		return logClass;
	}

	public void setLogClass(int logClass) {
		this.logClass = logClass;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getTimeZone() {
		return timeZone;
	}

	public void setTimeZone(int timeZone) {
		this.timeZone = timeZone;
	}
}
